﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoVanHocTapData.Interface;
using CoVanHocTapData.Entities;

namespace CoVanHocTapData.Concretes
{
    public class HocKyRepository:IHocKyRepository
    {
        DangKyPhuEntities entities;

        public HocKyRepository()
        {
            entities = new DangKyPhuEntities();
        }

        public IQueryable<int> LayHocKyID(int nienKhoaID)
        {
            return (from m in entities.HocKies
                        where m.NgayBatDau.Value.Year>=nienKhoaID
                        select m.HocKyID);
        }


        public HocKy LayHocKyHienTai()
        {
            return (from m in entities.HocKies
                        where m.LaHocKyHienHanh==true
                        select m).FirstOrDefault();
        }
    }
}
